package LeetCode;

import java.util.Scanner;

/**
 * 两数之和
 */
public class Main001 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入数组长度");
        int n=sc.nextInt();
        int nums[]=new int[n];
        for (int i = 0; i < nums.length; i++) {
            int a=sc.nextInt();
            nums[i]=a;
        }
        System.out.println("输入target");
        int target=sc.nextInt();
        twoSum(nums,target);
    }
    public static int[] twoSum(int[] nums, int target) {
        for (int i =0 ; i < nums.length; i++) {
            for (int j = i+1; j < nums.length; j++) {
                if (nums[i]+nums[j]==target) {
                    return new int[]{i,j};
                }
            }
        }
        return new int[0];
    }
}